package com.sip.dbadapter.dao.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 */
@Entity
@Table(name = "RESULT_RECORD")
public class ResultRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long recordId;

    private Integer resultType;

    private Boolean status;

    private Date recordDate;

    private Set<ScenarioRecord> scenarioRecordSet;

    public ResultRecord() {

    }

    @Id
    @Column(name = "RECORD_ID", unique = true, nullable = false)
    @GeneratedValue
    public Long getRecordId() {

        return recordId;
    }

    @Column(name = "RESULT_TYPE")
    public Integer getResultType() {

        return resultType;
    }

    @Column(name = "STATUS")
    public Boolean getStatus() {

        return status;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "RECORD_DATE")
    public Date getRecordDate() {

        return recordDate;
    }

    @OneToMany(mappedBy = "resultRecord")
    public Set<ScenarioRecord> getScenarioRecordSet() {

        return scenarioRecordSet;
    }

    public void setRecordId(Long recordId) {

        this.recordId = recordId;
    }

    public void setResultType(Integer resultType) {

        this.resultType = resultType;
    }

    public void setStatus(Boolean status) {

        this.status = status;
    }

    public void setRecordDate(Date recordDate) {

        this.recordDate = recordDate;
    }

    public void setScenarioRecordSet(Set<ScenarioRecord> scenarioRecordSet) {

        this.scenarioRecordSet = scenarioRecordSet;
    }

    @Override
    public int hashCode() {

        int result = 0;
        result = (int) (31 * result + recordId);
        result = 31 * result + (resultType != null ? resultType.hashCode() : 0);

        return result;
    }

    @Override
    public boolean equals(Object other) {

        if (this == other)
            return true;

        if (other == null || (this.getClass() != other.getClass())) {
            return false;
        }

        ResultRecord record = (ResultRecord) other;
        return (this.recordId == record.recordId) && (this.resultType != null && resultType.equals(record.resultType));

    }

}
